import threading
import time


class GetDetailHtml(threading.Thread):

    def __init__(self, name):
        super().__init__(name=name)

    def run(self):
        print('get detail html started')
        time.sleep(2)
        print('get detail html finished')


class GetDetailUrl(threading.Thread):
    def __init__(self, name):
        super().__init__(name=name)

    def run(self):
        print('get detail url started')
        time.sleep(4)
        print('get detail url finished')


if __name__ == "__main__":
    get_detail_html = GetDetailHtml('get_html_detail')
    get_detail_url = GetDetailUrl('get_html_url')
    start_time = time.time()
    get_detail_html.start()
    get_detail_url.start()
    get_detail_html.join()
    get_detail_url.join()
    print('main thread finished')
    print('last time: {}'.format(time.time() - start_time))
